<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
      <div class="subject">
        <h3>最新活动 - 添加最新活动</h3>
        <h5>添加或编辑活动</h5>
      </div>
    </div>
  </div>
  <div class="explanation" id="explanation">
    <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
      <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
      <span id="explanationZoom" title="收起提示"></span>
    </div>
    <ul>
      <li>请不要误删除分类栏目，否则不可恢复</li>
    </ul>
  </div>
  <form action="{:U('Destine/addnewActivity')}" method="post" class="form-horizontal" id="category_form">
    <div class="ncap-form-default">
      <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>活动名称</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="名称" class="input-txt" name="title" value="{$activity.title}">
        </dd>
      </dl>
	  <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>活动页面URL</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="链接地址" class="input-txt" name="acurl" value="{$activity.acurl}">
          <span class="err" id="err_name" style="color:#F00; display:none;"></span>
          <p class="notic"></p>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>活动发布时间</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="选择活动发布时间" id="datetimepicker" class="input-txt" name="publishtime" value="<if !empty($activity.publishtime)>{$activity.publishtime|date='Y/m/d H:i',###}</if>">
          <script type="text/javascript">
	        	$('#datetimepicker').datetimepicker({step:10});
	        </script>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>活动开始时间</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="选择活动开始时间" id="datetimepicker1" class="input-txt" name="starttime" value="<if !empty($activity.starttime)>{$activity.starttime|date='Y/m/d H:i',###}</if>">
          <script type="text/javascript">
	        	$('#datetimepicker1').datetimepicker({step:10});
	        </script>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>活动结束时间</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="选择活动结束时间" id="datetimepicker2" class="input-txt" name="endtime" value="<if !empty($activity.endtime)>{$activity.endtime|date='Y/m/d H:i',###}</if>">
          <script type="text/javascript">
	        	$('#datetimepicker2').datetimepicker({step:10});
	        </script>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">活动图片</dt>
        <dd class="opt">
          <div class="input-file-show" id="divComUploadContainer">
            <span class="show">
                <a class="nyroModal" rel="gal" href="{$activity.thumbnail}">
                    <i class="fa fa-picture-o" onmouseover="layer.tips('<img src={$activity.thumbnail}>',this, {tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                </a>
            </span>           
            <span class="type-file-box">            
            <input type="text" id="imagetext" name="thumbnail" value="{$activity.thumbnail}" class="type-file-text">            
            <input type="button" class="type-file-button" onClick="GetUploadify(1,'imagetext','category','')" value="上传图片" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/> 
            </span>
          </div>
          <div id="thumbnails" class="ncap-thumb-list">
            <h5><i class="fa fa-exclamation-circle"></i> 请上传图片格式文件。</h5>
            <ul>
            </ul>
          </div>
        </dd>
      </dl> 
	    <if !empty($activity)>
	        <input name="id" value="{$activity.id}" type="hidden" />
	    </if>
      <div class="bot"><a id="submitBtn" class="ncap-btn-big ncap-btn-green" href="JavaScript:void(0);" onClick="ajax_submit_form('category_form','{:U('Destine/addeditActivity?is_ajax=1')}');">确认发布</a></div>
    </div>
  </form>
</div>
<script>  
    
/** 以下是编辑时默认选中某个商品分类*/
$(document).ready(function(){
	<if condition="$level_cat['2'] gt 0">	
		 // 如果当前是二级分类就让一级父id默认选中
		 $("#parent_id_1").val('{$level_cat[1]}'); 
		 get_category('{$level_cat[1]}','parent_id_2','0');		 
	</if>	 
	<if condition="$level_cat['3'] gt 0">
		 // 如果当前是三级分类就一级和二级父id默认 都选中
		 $("#parent_id_1").val('{$level_cat[1]}');		 	
		 get_category('{$level_cat[1]}','parent_id_2','{$level_cat[2]}');	
	</if>	
});
 
// 将品牌滚动条里面的 对应分类移动到 最上面
//javascript:document.getElementById('category_id_3').scrollIntoView();
var typeScroll = 0;
function spec_scroll(o){
	var id = $(o).val();	
	//if(!$('#type_id_'+id).is('dt')){
		//return false;
	//} 	 
	$('#ajax_brandList').scrollTop(-typeScroll);
	var sp_top = $('#type_id_'+id).offset().top; // 标题自身往上的 top
	var div_top = $('#ajax_brandList').offset().top; // div 自身往上的top
	$('#ajax_brandList').scrollTop(sp_top-div_top); // div 移动
	typeScroll = sp_top-div_top;
} 
</script>
</body>
</html>